package com.lotusfall.service;


import com.github.pagehelper.Page;
import com.github.pagehelper.PageInfo;
import com.lotusfall.api.ApiHouseResourcesService;
import com.lotusfall.pojo.HouseResource;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class HouseResourceService {
    @DubboReference(version = "1.0")
    ApiHouseResourcesService apiHouseResourcesService;

    /**
     *  新增房源
     * @param houseResource
     * @return -1:输入的参数不合要求  0：数据插入数据库失败   1：成功
     */
    public int saveHouseResources(HouseResource houseResource){
        return this.apiHouseResourcesService.saveHouseResources(houseResource);
    }

    /**
     * 分页查询房源列表
     *
     * @param page 当前页
     * @param pageSize 页面大小
     * @param queryCondition 查询条件
     * @return
     */
    PageInfo<HouseResource> queryHouseResourcesList(int page, int pageSize){
        return this.apiHouseResourcesService.queryHouseResourcesList(page,pageSize);
    }

    /**
     * 根据id查询房源数据
     *
     * @param id
     * @return
     */
    HouseResource queryHouseResourcesById(Long id){
        return this.apiHouseResourcesService.queryHouseResourcesById(id);
    }

    /**
     * 更新房源数据
     *
     * @param houseResource
     * @return
     */
    boolean updateHouseResource(HouseResource houseResources){
        return this.apiHouseResourcesService.updateHouseResource(houseResources);
    }

    public PageInfo<HouseResource> queryHouseList(Integer page, Integer pageSize) {

        return this.apiHouseResourcesService.queryHouseResourcesList(page, pageSize);

    }

    public PageInfo<HouseResource> queryHouseListByNum(Integer page, Integer pageSize, Integer type, Integer ori, Integer area, Integer rent) {
        return this.apiHouseResourcesService.queryHouseResourcesListByNum(page,pageSize,type,ori,area,rent);
    }
}
